﻿#pragma once

#include <QObject>
#include <QProcess>
#include <qsharedmemory.h>
enum CMDIndex {
    argv_w = 0,
    argv_f = 1,
    argv_l = 2,
    argv_waitTime = 3,
    argv_info = 4,
    argv_shmName = 5,
    argv_shmCheckInterval = 6,
    argv_shmCheckErrorValue = 7,
    argv_switch,
};
class WatchDog  : public QObject
{
	Q_OBJECT

public:
	WatchDog(QObject* parent = nullptr);
	~WatchDog();
    bool setArgv(int& argc, char** argv);
protected:
    void timerEvent(QTimerEvent* event);
private:
    //QString w = "C:\\Users\\wangxiaofeng\\Desktop\\WatchDogTestAPP\\QtConsoleApplication1\\x64\\Release\\QtConsoleApplication1.exe";
    //QString w = "C:\\Users\\wangxiaofeng\\Desktop\\ZNWorks\\ZNWorks.exe";
    QString w = "";
    QStringList f;
    QStringList l;
    uint32_t waitTime = 0;
    bool info = false;
    QProcess p;

    QString shmName = "";
    QSharedMemory shm;
    int shmCheckInterval = 1000;
    int shmCheckErrorValue = 3;
    uint32_t shmDataImage = 0;
    uint32_t shmDataCounter = 0;
};
